﻿using Newtonsoft.Json;
using System;

namespace YKPrintService.VO
{
    public class ObjectRestResponse<T>
    {

        public static readonly String REST_RESPONSE_OK = "ok";

        /**
         * 返回码，正确返回0，【注意：结果正确与否的判断请用此返回参数】，错误返回非零
         */
        private int code;
        /**
         * 结果提示信息，正确返回”ok”，如果有错误，返回错误信息
         */
        private String msg;
        /**
         * 数据类型和内容详看私有返回参数data，如果有错误，返回null
         */
        private T data;
        /**
         * 服务器程序执行时间，单位：毫秒
         */
        private long serverExecutedTime;

        public ObjectRestResponse()
        {
            this.code = 0;
            this.msg = REST_RESPONSE_OK;
        }
        [JsonProperty("code")]
        public int Code
        {
            get { return this.code; }
            set { this.code = value; }
        }
        [JsonProperty("msg")]
        public string Msg
        {
            get { return this.msg; }
            set { this.msg = value; }
        }
        [JsonProperty("data")]
        public T Data
        {
            get { return this.data; }
            set { this.data = value; }
        }
        [JsonProperty("serverExecutedTime")]
        public long ServerExecutedTime
        {
            get { return serverExecutedTime; }
            set { serverExecutedTime = value; }
        }
    }
}
